#include "Store.h"
#include "mtmtest.h"
#include "mtm_ex4.h"
using namespace mtm;

void storeExample(){
	Store s;

	ASSERT_NO_THROW(s.addAlbum(3,33,1933,333,"song3","artist3"));
	ASSERT_NO_THROW(s.addAlbum(4,44,1944,444,"song4","artist4"));
	ASSERT_NO_THROW(s.addCustomer(6,"customer6"));
	ASSERT_NO_THROW(s.addCustomer(5,"customer5"));
	ASSERT_NO_THROW(s.createNewOrder(6,8));
	ASSERT_NO_THROW(s.createNewOrder(5,7));
	ASSERT_NO_THROW(s.addToOrder(8,4));
	ASSERT_NO_THROW(s.addToOrder(7,4));
	ASSERT_NO_THROW(s.addToOrder(8,3));
	ASSERT_NO_THROW(s.addToOrder(7,4));
	ASSERT_NO_THROW(s.payOrder(8));
	ASSERT_NO_THROW(s.createNewOrder(6,9));
	ASSERT_NO_THROW(s.addToOrder(9,3));


	ASSERT_EQUALS(getRecommendationsHeaderString(2)+
			getAlbumFullString(4,44,1944,445,"song4","artist4")+
			getAlbumFullString(3,33,1933,334,"song3","artist3"),s.getRecommendations(2));
	ASSERT_EQUALS(getAlbumsHeaderString(2)+
			getAlbumFullString(3,33,1933,334,"song3","artist3")+
			getAlbumFullString(4,44,1944,445,"song4","artist4"),s.getInventoryReport());
	ASSERT_EQUALS(getCustomersHeaderString(2)+
			getCustomerDescriptionString(5,"customer5")+
			getCustomerDescriptionString(6,"customer6"),s.getCustomersReport());
	ASSERT_EQUALS(getCustomerHeaderString(5,"customer5",0)+
			getOrderHeaderString(7,5,2,false)+
			getAlbumMinimalString("song4","artist4",1944,44)+
			getAlbumMinimalString("song4","artist4",1944,44),s.getCustomerReport(5));
	ASSERT_EQUALS(getCustomerHeaderString(6,"customer6",2)+
			getOrderHeaderString(8,6,2,true)+
			getAlbumMinimalString("song4","artist4",1944,44)+
			getAlbumMinimalString("song3","artist3",1933,33)+
			getOrderHeaderString(9,6,1,false)+
			getAlbumMinimalString("song3","artist3",1933,33),s.getCustomerReport(6));
	ASSERT_EQUALS(getRevenueHeaderString(2,2,77)+
			getRevenueFromCustomerString(5,"customer5",0,0)+
			getRevenueFromCustomerString(6,"customer6",2,77),s.getRevenueReport());
}

int main(){
	RUN_TEST(storeExample);
	return 0;
}



